_base_ = ["../_base_/datasets/scut.py", "../_base_/default_runtime.py"]
# model settings

anchor_base_sizes = [[(10, 11), (11, 13), (13, 15)],
                     [(14, 18), (17, 19), (20, 23)],
                     [(26, 30), (40, 45), (70, 81)]]
model = dict(type="YOLOV3",
             pretrained="open-mmlab://darknet53",
             backbone=dict(type="Darknet", depth=53, out_indices=(3, 4, 5)),
             neck=dict(type="YOLOV3Neck",
                       num_scales=3,
                       in_channels=[1024, 512, 256],
                       out_channels=[512, 256, 128]),
             bbox_head=dict(type="YOLOV3Head",
                            num_classes=1,
                            in_channels=[512, 256, 128],
                            out_channels=[1024, 512, 256],
                            anchor_generator=dict(type="YOLOAnchorGenerator",
                                                  base_sizes=anchor_base_sizes,
                                                  strides=[32, 16, 8]),
                            bbox_coder=dict(type="YOLOBBoxCoder"),
                            featmap_strides=[32, 16, 8],
                            loss_cls=dict(type="CrossEntropyLoss",
                                          use_sigmoid=True,
                                          loss_weight=1.0,
                                          reduction="sum"),
                            loss_conf=dict(type="CrossEntropyLoss",
                                           use_sigmoid=True,
                                           loss_weight=1.0,
                                           reduction="sum"),
                            loss_xy=dict(type="CrossEntropyLoss",
                                         use_sigmoid=True,
                                         loss_weight=2.0,
                                         reduction="sum"),
                            loss_wh=dict(type="MSELoss",
                                         loss_weight=2.0,
                                         reduction="sum")))
# training and testing settings
train_cfg = dict(assigner=dict(
    type="GridAssigner", pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0))
test_cfg = dict(nms_pre=1000,
                min_bbox_size=0,
                score_thr=0.05,
                conf_thr=0.005,
                nms=dict(type="nms", iou_thr=0.45),
                max_per_img=100)
# optimizer
optimizer = dict(type="SGD", lr=0.001, momentum=0.9, weight_decay=0.0005)
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
# learning policy
lr_config = dict(
    policy="step",
    warmup="linear",
    warmup_iters=100,  # same as burn-in in darknet
    warmup_ratio=0.001,
    step=[40, 60])
# runtime settings
total_epochs = 70
